package com.wc.AlgoOJ_train.train1.c0.A013;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/12/25 10:57
 * @description 数据的交换输出
 * http://43.138.190.70:8888/p/A013
 */
public class Main {
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            if (n == 0) {
                break;
            }
            int[] arr = new int[100];
            int minNum = Integer.MAX_VALUE;
            int minIdx = -1;
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
                if (arr[i] < minNum) {
                    minIdx = i;
                    minNum = arr[i];
                }
            }
            arr[minIdx] = arr[0];
            arr[0] = minNum;
            out.print(arr[0]);
            for (int i = 1; i < n; i++) {
                out.print(" " + arr[i]);
            }
            out.println();
            out.flush();
        }
    }
}
